<?php echo $this->render("header.phtml"); ?>
<label class="title">Update an article</label>
<div class="horiz_sep">&nbsp;</div>
<?php 
	$article = (object)$this->article;
	$errors = $this->errors; 
?>
<form action="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/save-edit-article-unpublished/<?php echo $article->art_id."-".$this->currentPage."-".str_ireplace(" ", "-", $article->art_title);?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="article_id" value="<?php echo $article->art_id; ?>"/>
<input type="hidden" name="currentPage" value="<?php echo $this->currentPage; ?>"/>
<input type="hidden" name="art_image" value="<?php echo $article->art_image; ?>"/>
<input type="hidden" name="art_has_image" value="<?php echo $article->art_has_image; ?>"/>
<table cellpadding="5" cellspacing="0" width="100%" border="0">
	<?php if (count($errors)){ ?>
	<tr>
		<td>
			<? 
				if (key_exists('title_null', $errors)) $title_null = $errors['title_null'];
				else $title_null = "";
				if (key_exists('content_null', $errors)) $content_null = $errors['content_null'];
				else $content_null = "";
			?>
			<font color="red" style="font-weight:bold;">
				<? if (strlen($title_null)) echo "<p> * ".$title_null."</p>"; ?>
				<? if (strlen($content_null)) echo "<p> * ".$content_null."</p>"; ?>
			</font>
		</td>
	</tr>
	<?php } ?>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<b>Title: <font color="red">*</font></b>
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="article_title" value="<?php echo stripslashes($article->art_title);?>"  style="width:100%; padding:2px;"/>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<b>Description:</b>
					</td>
				</tr>
				
				<tr>
					<td>
						<textarea name="article_lead" style="width:100%; font-size: 9pt;" rows="5"><?php echo stripslashes($article->art_lead);?></textarea>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<b>Content: <font color="red">*</font></b>
					</td>
				</tr>
				<tr>
					<td>
					<textarea name="article_content" rows="5"><?php echo $this->escape(trim(stripslashes($article->art_content)));?></textarea>
						<script src="<?= $this->baseUrl ?>/public/scripts/fckeditor/fckeditor.js" type="text/javascript"></script>	
						<script type="text/javascript">
							<!--
							// Automatically calculates the editor base path based on the _samples directory.
							// This is usefull only for these samples. A real application should use something like this:
							// oFCKeditor.BasePath = '/fckeditor/' ;	// '/fckeditor/' is the default value.
							var sBasePath = '<?= $this->baseUrl ?>/public/scripts/fckeditor/' ;
							var oFCKeditor = new FCKeditor( 'article_content' ) ;
							oFCKeditor.BasePath	= sBasePath ;
							oFCKeditor.Height	= 300 ;
							oFCKeditor.ReplaceTextarea() ;
							//-->
						</script>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="7%">
						<b>Image</b>
					</td>					
					<td>
						<input type="file" name="image_file" />
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="7%">
						Published
					</td>
					<?php 
						if ($article->art_published) $checked="checked";
						else $checked = "";
					 ?>
					<td>
						<input type="checkbox" name="published" value="1" <?php echo $checked;?>/>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td>
			<input type="submit" name="save" value="Save"/>
		</td>
	</tr>
</table>
</form>
<?php echo $this->render("footer.phtml"); ?>